home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / mint / mgr / vdimgr.zoo / contrib / etc / omgrterm.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-03-16  |  2.5 KB  |  95 lines

  1. /*
  2. From: david@doe.utoronto.ca (David Megginson)
  3. Newsgroups: comp.sys.atari.st
  4. Subject: rmgr works!
  5. Summary: You can use rmgr on a Sparc with mgr on the ST
  6. Date: 12 Jan 91 20:15:07 GMT
  7. Organization: Dictionary of Old English Project - U of Toronto
  8.  
  9. Howard Chu's rmgr is now working with my ST and a Sparcstation! rmgr
  10. does _not_ require mgr on the Unix machine, only on yours. Right now,
  11. I have two windows open talking to the SparcStation over my (1200 baud)
  12. modem, and two windows open to my ST. I just tried cutting and pasting
  13. between Sun and ST windows, and it worked fine. I don't know why I
  14. waited so long to try this out. It's like Unix windows, except that
  15. some of the windows can be open to your ST too.
  16.  
  17. To use rmgr, I wrote a simple (ie. REALLY simple) terminal program
  18. term.c to set up a terminal over the modem. To quit the program, you
  19. type ^]. You must set baud rate, etc, elsewhere. Here are the sources
  20. for the program. The binaries are only 1265 bytes on my machine (with
  21. optimisation, stripping symbol table, etc). Here is the source (I am
  22. posting it here because it is so small):
  23.  
  24. */
  25.  
  26. /****************************************************************/
  27. /*    term.c:    a _really_ simple terminal emulator        */
  28. /*    by David Megginson, 1991                */
  29. /*    This program is released to the public domain        */
  30. /****************************************************************/
  31.  
  32. #include <osbind.h>
  33. #include <mintbind.h>
  34. #include <minimal.h>
  35.  
  36. #define    QUIT    0x1d        /* ^] to quit the terminal        */
  37. #define    MAXWAIT    20000L        /* Maximum number of failed attempts    */
  38.                 /* to read a character before we    */
  39.                 /* start snoozing            */
  40.  
  41.  
  42. main()
  43. {
  44.     long counter = 0;
  45.     short c, found;
  46.  
  47.     do{
  48.         /* We haven't found any activity yet    */
  49.         
  50.         found = 0;
  51.  
  52.         /* Check for a character from the modem    */
  53.         
  54.         if( Bconstat(1) ) {
  55.             found = 1;
  56.             c = Bconin(1) & 0x7f;
  57.             Bconout(2,c);
  58.         }
  59.  
  60.         /* Check for a character from the cons    */
  61.         
  62.         if( Bconstat(2) ) {
  63.             found = 1;
  64.             c = Bconin(2) & 0x7f;
  65.             if( c == QUIT )
  66.                 break;
  67.             Bconout(1,c);
  68.         }
  69.  
  70.  
  71.         /* Don't soak up CPU time if there is    */
  72.         /* nothing going on!            */
  73.         
  74.         if( found ) {
  75.             counter = 0L;
  76.         } else if( counter < MAXWAIT ) {
  77.             counter++;
  78.         } else {
  79.             Syield();
  80.         }
  81.  
  82.     } while( 1 );
  83.     
  84.     return 0;
  85. }
  86.  
  87. /* end of term.c */
  88.  
  89. /*
  90. ////////////////////////////////////////////////////////////////////////
  91. /  David Megginson                      david@doe.utoronto.ca          /
  92. /  Centre for Medieval Studies          meggin@vm.epas.utoronto.ca     /
  93. ////////////////////////////////////////////////////////////////////////
  94. */
  95.